import java.util.ArrayList;
import java.util.List;

public class EnvironmentSensor {
    private List<FarmMachineObserver> observers = new ArrayList<>();

    public void addObserver(FarmMachineObserver observer) {
        observers.add(observer);
    }

    public void changeDetected() {
        System.out.println("环境变化被检测到，通知所有农机...");
        for (FarmMachineObserver observer : observers) {
            observer.update();
        }
    }
}